#pragma warning disable 0618
using System;
using System.Collections.Generic;
using Table.DataModel;
namespace Table.Dao
{
    public class TablePlotDao:DaoBase<TablePlot>
    {
        public override string GetFileName()
        {
            return "TablePlot.csv";
        }
        public override void BuildIndex()
        {
            if (cacheList != null)
            {
                cachePrimaryInt = new Dictionary<int, TablePlot>(cacheList.Count);
            }
            base.BuildIndex();
        }
        public override void AddOneIndex(TablePlot model)
        {
            if (!cacheOneIndex.ContainsKey(model.plotSeqId.ToString()))
            {
                cacheOneIndex[model.plotSeqId.ToString()] = new List<TablePlot>();
            }
            cacheOneIndex[model.plotSeqId.ToString()].Add(model);
        }
        public override void AddPrimaryIndex(TablePlot model)
        {
            #if UNITY_EDITOR
            if(cachePrimaryInt.ContainsKey(model.id)) UnityEngine.Debug.LogError("数据表id重复:TablePlot->id: " + model.id);
            #endif
            cachePrimaryInt[model.id] = model;
        }
        protected override TablePlot ParseRowData(string[] rowData)
        {
            TablePlot data = new TablePlot();
            if (!string.IsNullOrEmpty(rowData[0]))
            {
                data.id = int.Parse(rowData[0]);
            }
            if (!string.IsNullOrEmpty(rowData[1]))
            {
                data.plotSeqId = int.Parse(rowData[1]);
            }
            if (!string.IsNullOrEmpty(rowData[2]))
            {
                data.plotStepID = int.Parse(rowData[2]);
            }
            if (!string.IsNullOrEmpty(rowData[3]))
            {
                data.plotType = int.Parse(rowData[3]);
            }
            if (!string.IsNullOrEmpty(rowData[4]))
            {
                data.plotParam1 = rowData[4];
            }
            if (!string.IsNullOrEmpty(rowData[5]))
            {
                data.plotParam2 = rowData[5];
            }
            if (!string.IsNullOrEmpty(rowData[6]))
            {
                data.plotParam3 = rowData[6];
            }
            if (!string.IsNullOrEmpty(rowData[7]))
            {
                data.inStyle = int.Parse(rowData[7]);
            }
            if (!string.IsNullOrEmpty(rowData[8]))
            {
                data.outStyle = int.Parse(rowData[8]);
            }
            if (!string.IsNullOrEmpty(rowData[9]))
            {
                data.hideNpc = int.Parse(rowData[9]);
            }
            if (!string.IsNullOrEmpty(rowData[10]))
            {
                data.hidePlayer = int.Parse(rowData[10]);
            }
            if (!string.IsNullOrEmpty(rowData[11]))
            {
                data.hideOtherPlayers = int.Parse(rowData[11]);
            }
            if (!string.IsNullOrEmpty(rowData[12]))
            {
                data.hideUI = int.Parse(rowData[12]);
            }
            if (!string.IsNullOrEmpty(rowData[13]))
            {
                data.disableBgm = int.Parse(rowData[13]);
            }
            if (!string.IsNullOrEmpty(rowData[14]))
            {
                data.isOnlyOnce = int.Parse(rowData[14]);
            }
            if (!string.IsNullOrEmpty(rowData[15]))
            {
                data.playerStartPosId = int.Parse(rowData[15]);
            }
            if (!string.IsNullOrEmpty(rowData[16]))
            {
                data.playerEndPosId = int.Parse(rowData[16]);
            }
            if (!string.IsNullOrEmpty(rowData[17]))
            {
                data.barrageTimeLen = int.Parse(rowData[17]);
            }
            if (!string.IsNullOrEmpty(rowData[18]))
            {
                data.barrageOpen = int.Parse(rowData[18]);
            }
            return data;
        }
    }
}
